package com.gitee.l0km.codegen.base.generator;

import java.io.File;

import com.gitee.l0km.com4j.base.Assert;

public class FileBuilder {
	public static final class Builder {
		private File file;

		private Builder(File file) {
			Assert.notNull(file, "file");
			this.file = file;
		}

		public Builder append(String path) {
			Assert.notNull(path, "path");
			if(!path.isEmpty())
				file = new File(file, path);
			return this;
		}

		public File build() {
			return file;
		}
	}

	public static final Builder from(String file) {
		Assert.notEmpty(file, "file");
		return from( new File(file));
	}

	public static final Builder from(File file) {
		return new Builder(file);
	}

}
